package com.spa.application.command.admin;

import com.spa.infrastructure.util.UrlUtil;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.util.List;

@Data
public class MassageServiceEditCommand {

    private Long id;

    private String name;

    private Integer duration;

    @DecimalMin(value = "1", message = "请正确输入金额")
    @NotNull
    private Integer price;

    private Integer discountPrice = 0;

    private String cover;

    private List<String> imgList;

    private String recommendations;

    private String sex;

    private String targetGroup;

    private String highlights;

    private List<String> highlightsTarList;

    private List<String> noteList;

    private List<String> declarationList;

    private List<Flow> flowList;

    public void setCover(String cover) {
        this.cover = UrlUtil.handleUrl(cover, ",");
    }

    public void setImgList(List<String> imgList) {
        this.imgList = UrlUtil.handleUrlList(imgList);
    }

    @Data
    public static class Flow {

        private String content;

        private Integer duration;

        private Integer sort;

        private String img;

        public void setImg(String img) {
            this.img = UrlUtil.handleUrl(img, ",");
        }
    }
}
